package com.logistics.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.logistics.Template;
import com.logistics.admin.AdminGenericBaseAction;
import com.logistics.service.TemplateService;

/**
 * @author hzz
 *
 * 2014年3月30日
 */

@Component("templateAdminAction")
@Scope("prototype")
public class TemplateAdminAction extends AdminGenericBaseAction<Template, TemplateService> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private TemplateService service;
	
	@Autowired
	public void setService(TemplateService service) {
		this.service = service;
	}

	@Override
	public TemplateService getService() {
		return service;
	}
	
	private Template template;

	public Template getTemplate() {
		return template;
	}

	public void setTemplate(Template template) {
		this.template = template;
	}

	@Override
	protected Template initEntityForAdd() {
		return template;
	}

	private List<Template> templates;

	public List<Template> getTemplates() {
		return templates;
	}

	public void setTemplates(List<Template> templates) {
		this.templates = templates;
	}
	
	public String list() {
		templates = service.query(getPaging());
		
		return LIST;
	}
	
	@Override
	protected void initEditForm() {
		template = service.getById(getId());
	}
	
}
